Methods and Apparatus for Image Processing at Pixel Rate

ABSTRACT

Embodiments of the present invention provide for improved timing control in 2-D image processing to maintain a constant rate of memory fetches and pixel outputs even when the processing operations transition to a new line or frame of pixels. A one-to-one relationship between incoming pixel rate and outgoing pixel rate is maintained without additional clock cycles or memory bandwidth as an improved timing control according to the present invention takes advantage of idle memory bandwidth by pre-fetching a new column of pixel data in a first pixel block of a next line or frame while a new column of an edge pixel block on a current line is duplicated or zeroed out. As the edge pixel block(s) on the current line are processed, the data in the first pixel block of the next line or frame become ready for computation without extra clock cycles or extra memory bandwidth.

FIELD OF THE INVENTION

This invention relates generally to digital signal processing and computer graphics, and more particularly, to image processing at pixel rate.

BACKGROUND OF THE INVENTION

In processing two-dimensional (2-D) images, it is known to apply a small matrix or kernel to successive pixel blocks to generate output pixels. For example, in 2-D convolution operations, an n×m matrix (“convolution mask”) is typically applied to an image following a raster pattern and, for each pixel in the image, the convolution mask is centered on that pixel and convolved with the corresponding n×m pixels in the image to compute an output pixel value. The output pixels so generated then collectively form a new (processed) digital image. Depending on the convolution mask used, 2-D convolution operations can filter out noise, enhance object edges, or achieve other desired effects on a digital image. Similarly, in 2-D correlation operations, a matrix is applied to an image in raster mode and computed with each pixel and its neighboring pixels to generate a corresponding output pixel. These and other kernel-based 2-D processing operations can be implemented in software or hardware and applied to still images or frames in video sequences.

FIG. 1 shows an exemplary image 100 having a 26×20 array of pixels, each small square representing one pixel. A 3×3 kernel 102 may be applied to the image 100, starting from the top left corner (i.e., Pixel A1) and passing from edge to edge, line by line in raster mode. For each pixel in the image 100, the digital values of a corresponding pixel block—that pixel and its eight neighboring pixels—need to be retrieved from a memory device or an input buffer before those pixel data are computed with the values of the kernel matrix. The steps of retrieving the pixel data and computing the pixel data with the kernel are typically pipelined, driven by a clock at pixel rate. As the kernel is advanced to the next pixel, for example, from Pixel K16 (marked “1”) to Pixel L16 (marked “2”) in the image 100, only one new column of pixel data (i.e., those of Pixels M15-17) needs to be retrieved. That is, during each clock cycle in the pipelined process, only one new column of pixel data is retrieved from the memory or input buffer, and one output pixel value is usually generated at the same time. Thus, when those pixel blocks located completely within the boundaries of the image 100 (“internal pixel blocks”) are processed, there can be a one-to-one relationship between the rate of retrieving pixel data columns and the outgoing pixel rate.

However, such a fetch-one-column-and-output-one-pixel timing pattern cannot be maintained when the kernel reaches an edge of the image and is about to start scanning and operating on a new line or frame. FIG. 2 illustrates this problem, again with the image 100 and the kernel 102. The pixel block covered by the kernel 102 in FIG. 2, which is centered on Pixel Z16, may be referred to as an “edge pixel block.” As the kernel 102 moves from the last pixel on line 16 (Pixel Z16) to the first pixel on line 17 (Pixel A17), two new columns of pixel data (i.e., those of Pixels A16-18 and B16-18) need to be fetched before the output pixel value corresponding to Pixel A17 can be computed. A similar problem exists with kernels of other sizes and when the kernel transitions to a new frame in a video sequence. In order to maintain the outgoing pixel rate during the transition, conventional 2-D image processing approaches would require either extra clock cycles for the extra column(s) to be fetched or a memory bandwidth much larger than what is used for non-edge pixel blocks. Neither of these solutions is desirable for lack of efficiency.

SUMMARY OF THE INVENTION

Embodiments of the present invention provide for improved timing control in 2-D image processing to maintain a constant rate of memory fetches and pixel outputs even when the processing operations transition to a new line or frame of pixels.

In one aspect of the invention, a method for processing one or more images having a plurality of pixels includes processing successive pixel blocks in raster mode between a first edge and a second edge of an image. During each single clock unit when a next pixel block to be processed does not extend beyond said second edge, one new vector (i.e., a row or a column) of the next pixel block is fetched from a storage device. During each single clock unit when said next pixel block to be processed extends beyond said second edge, a new vector in said next pixel block that is located beyond said second edge is filled with predetermined pixel values while one new vector of a first pixel block on a next line or frame of pixels is fetched from said storage device. In said each single clock unit, one output pixel value is generated, thereby maintaining a constant rate of memory fetches and pixel outputs.

In another aspect of the invention, an apparatus for processing one or more images having a plurality of pixels includes: (i) means for processing successive pixel blocks in raster mode between a first edge and a second edge of an image; (ii) means for, during each single clock unit when a next pixel block to be processed does not extend beyond said second edge, fetching one new vector of the next pixel block from a storage device; (iii) means for, during each single clock unit when said next pixel block to be processed extends beyond said second edge, filling a new vector in said next pixel block that is located beyond said second edge with predetermined pixel values and simultaneously fetching, from said storage device, one new vector of a first pixel block on a next line or frame of pixels; and (iv) means for outputting, in said each single clock unit, one output pixel value, thereby maintaining a constant rate of memory fetches and pixel outputs.

In still another aspect, an apparatus for processing successive pixel blocks in raster mode between a first edge and a second edge of an image may comprise: an input data interface coupled with one or more storage devices to receive at least one input stream of pixel values of said image; an array of pixel processing cells, each cell including a coefficient storage unit that stores a coefficient value of a kernel to be applied to said image during a two-dimensional image processing, a pixel storage unit that stores a pixel value of said image, said pixel storage unit being coupled either to another pixel storage unit of an adjacent cell or to said input data interface, thereby allowing said pixel value to be initially received via said input data interface and subsequently propagated from one vector to an adjacent vector across said array, a multiplexer unit, if said each cell is not in a center vector of said array, having inputs coupled to said pixel storage unit, a center-vector pixel storage unit on the same line of said array, and any pixel storage unit located between said center vector and said each cell, and one or more intra-cell operation units; inter-cell operation units that process outputs from said array of pixel processing cells to generate an output pixel value; and a timing control module that coordinates operations of said input data interface, said array of pixel processing cells, and said inter-cell operation units. During each single clock unit when a next pixel block to be processed does not extend beyond said second edge, said timing control module causes one new vector of said next pixel block to be fetched from said one or more storage devices. During each single clock unit when said next pixel block to be processed extends beyond said second edge, said timing control module causes a new vector in said next pixel block that is located beyond said second edge to be filled with predetermined pixel values while causing one new vector of a first pixel block on a next line or frame of pixels to be fetched from said one or more storage devices, thereby maintaining a constant rate of memory fetches and pixel outputs.

The present invention will now be described in more detail with reference to exemplary embodiments thereof as shown in the accompanying drawings. While the present invention is described below with reference to exemplary embodiments, it should be understood that the present invention is not limited thereto. Those of ordinary skill in the art having access to the teachings herein will recognize additional implementations, modifications, and embodiments, as well as other fields of use, which are within the scope of the present invention as described herein, and with respect to which the present invention may be of significant utility.

BRIEF DESCRIPTION OF THE DRAWINGS

Other objects, features and advantages will occur to those skilled in the art from the following description of a preferred embodiment and the accompanying drawings, in which:

FIG. 1 shows an exemplary image with an array of pixels;

FIG. 2 illustrates a disruption of constant pixel rate encountered in conventional 2-D image processing approaches;

FIG. 3 illustrates an exemplary method of 2-D image processing with a 3×3 kernel in accordance with an embodiment of the present invention;

FIG. 4 illustrates an exemplary method of 2-D image processing with a 5×3 kernel in accordance with an embodiment of the present invention;

FIG. 5 shows an exemplary 2-D image processing engine in accordance with an embodiment of the present invention; and

FIG. 6 shows an exemplary 2-D convolution engine for image processing in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Embodiments of the present invention improve image processing and can maintain a one-to-one relationship between incoming pixel rate and outgoing pixel rate without additional clock cycles or memory bandwidth even when the processing operations transition to a new line or a new frame of pixels. An improved timing control according to the present invention takes advantage of idle memory bandwidth by pre-fetching a new column of pixel data in a first pixel block of a next line or frame while a new column of an edge pixel block on a current line is duplicated or zeroed out. As the edge pixel block(s) on the current line are processed, the data in the first pixel block of the next line or frame become ready for computation without extra clock cycles or extra memory bandwidth. More details, features, and advantages of the present invention can be appreciated with reference to the accompanying drawings and the detailed explanation below.

Referring to FIG. 3, there is illustrated an exemplary method of 2-D image processing with a 3×3 kernel 302 in accordance with an embodiment of the present invention. FIG. 3 shows part of a digital image 300 over which the kernel 302 is scanned in raster mode.

As used herein, the term “raster mode” refers to a line-by-line or line-after-line pattern of scanning a kernel over an image during 2-D image processing operations such as convolution or correlation. Typically, the kernel is advanced one pixel at a time and from one edge of the image to an opposite edge, thereby covering successive pixel blocks where each new block includes only one new column of pixels not in its adjacent block. However, the raster mode does not necessarily require the scanning to cover every single line of the image or consistently moving from one line to its next adjacent line. For example, the raster pattern may cover odd lines of an image and then cover even lines. Nor does the raster mode necessarily require a specific scanning direction on each line of the image. Furthermore, those skilled in the art will appreciate that the term “column” and “line” have relative significance when one is used in the context of the other. Therefore, a 2-D image processing implementation where a kernel is scanned column-wise and new lines of pixel data are pre-fetched also falls within the scope of the present invention herein disclosed.

In FIG. 3, the kernel 302 is scanned over the image 300 one line after another in raster mode. As the kernel 302 is advanced on Line 8 to the right edge of the image 300, the last complete pixel block covered by the kernel 302 is centered around Pixel Y8, and the last column of new data fetched on that line correspond to Pixels Z7-9. The values of Pixels Z7-9 may be fetched from a storage device (e.g., a memory, input buffer, or first-in-first-out (FIFO) device) during one clock unit. As used herein, the “clock unit” refers to a unit of time, such as one full clock cycle or one half of a clock cycle, that provides timing reference to or synchronizes logic gates or arithmetic devices during pipelined image processing operations.

As the kernel is advanced to the last pixel on Line 8 (i.e., Pixel Z8), the next pixel block to be processed, block 304, extends beyond the right edge of the image 300. A new column of pixel data (on Col. Z+1 and in the pixel block 304) that would otherwise need to be fetched from the storage device will instead receive values duplicated from pixels in a corresponding portion of the right edge of the image 300. That is, in one embodiment the new column (Col. Z+1) will be a copy of the values of the last column (Pixels Z7-9) which have already been fetched in the previous clock unit. In another embodiment, the image processor may be configured to fill the new column with zeros or other numeric values. That is, in general, the “new” column (Col. Z+1) is to be filled with pixel values that do not need to be fetched from the storage device. While Col. Z+1 is being filled with predetermined values (e.g., either duplicated values or zeros), memory bandwidth is available for fresh data to be fetched from the storage device. Accordingly, embodiments of the present invention take advantage of this idle memory bandwidth and may cause the first column of pixel data on the next line or frame of the image to be pre-fetched. In this particular example shown in FIG. 3, during the single clock unit while Col. Z+1 on Line 8 is being filled with pixel values duplicated from Col. Z or simply filled with zeros, the pixel values of the first column on Line 9, Pixels A8-10, may be pre-fetched from the storage device.

Then, in the next clock unit, the second column of pixel data on Line 9 may be pre-fetched from the storage device. The portion of the first pixel block on Line 9 that extends beyond the left edge of the image 300 may be filled with either pixel values of the first column (Pixels A8-10, already fetched in the previous clock unit) or zeros. As a result of the timing arrangement heretofore described, the image processor has been able to fetch one and only one new column of pixel data during each single clock unit, even when the 2-D image processing operations transition from Line 8 to Line 9 of the image 300. Such memory fetches performed at the constant input pixel rate, pipelined with the other computation steps, can therefore ensure a constant output rate of one output pixel value per clock unit.

FIG. 4 illustrates an exemplary method of 2-D image processing with a 5×3 kernel 402 in accordance with an embodiment of the present invention. FIG. 4 shows part of a digital image 400 over which the kernel 402 is scanned in raster mode.

When the center of the kernel 402 advances to Pixel X8, in clock unit T, the next pixel block to be processed, block 404, will be centered on Pixel Y8 and extend beyond the right edge of the image 400. During the single clock unit T while Col. Z+1 is being filled with zeros or values duplicated from Pixels Z7-9, the first column on the next line (Line 9), Pixels A8-10, may be pre-fetched from a storage device.

In the next clock unit T+1, the next pixel block to be processed, 406, will be centered on Pixel Z8 and extend even further beyond the right edge of the image 400. During the single clock unit T+1 while Col. Z+2 is being filled with zeros or values duplicated from Pixels Z7-9, the second column on Line 9 may be pre-fetched from the storage device.

In the next clock unit T+2, the next pixel block to be processed, 408, will be centered on Pixel A9. During the single clock unit T+2, the third column on Line 9 may be fetched from the storage device. Columns A-1 and A-2 on Line 9 may be filled with predetermined pixel values such as zeros or values of Pixels A8-10.

At the conclusion of the clock unit T+2, all elements of the first pixel block (408) on Line 9 are ready for computation with the kernel 402.

Embodiments of the present invention may be implemented in software, firmware, and/or hardware. Most preferably, embodiments of the present invention are implemented in a 2-D convolution or correlation compute engine as part of a digital image processing system or graphics acceleration apparatus.

FIG. 5 shows an exemplary 2-D image processing engine 500 in accordance with an embodiment of the present invention.

The 2-D image processing engine 500 includes an array of pixel processing cells (in this embodiment, a 5×3 array), an input data interface 502, inter-cell operation units 504, and a timing control module 506.

Each of the pixel processing cells in the array includes a coefficient storage unit, such as a data register (e.g., C_(A1) and C_(B2)), that stores a coefficient value of a kernel to be applied to a pixel block during a 2-D image processing (e.g., convolution or correlation operations). Each pixel processing cell also includes a corresponding pixel storage unit, such as a data register (e.g., D_(A1) and D_(B2)), that stores a pixel value of the pixel block. Each pixel storage unit is coupled with pixel storage units of adjacent pixel processing cells on the same line. If the pixel processing cell is in the edge column on the input side (here, Col. E), the pixel storage unit is also coupled to the data input interface 502 to receive fresh pixel data. As a result, a new column of pixel values may be obtained via the data input interface 502 and temporarily stored in the pixel storage units in the input side edge column, and the previously stored pixel values in each column of pixel storage units can be “pushed” or duplicated to the next column on the left. This arrangement forms a data path whereby a column of pixel values can be propagated from the data input interface 502 to the left, hopping one column per clock unit. By the end of each clock unit, the pixel values previously stored in the pixel storage units of the leftmost column, here Col. A, are overwritten and therefore discarded.

Each pixel processing cell, if it is not in the center column, here Col. C, also includes a multiplexer unit (“MUX”). The multiplexer unit has one input coupled to the pixel storage unit in the same cell. In addition, the multiplexer unit has inputs coupled to a center-column pixel storage unit on the same line as well as any pixel storage unit that is located between the center column and the current cell. As a result, data paths are created for each column not located on the left or right edge of the array (“non-edge column”) to duplicate its content outwardly to other column(s). To the extent the multiplexer units introduce additional delays in the non-center-column cells, delay elements may be included in the center-column cells to balance out the delays among the cells, as can be appreciated by those skilled in the art.

Each pixel processing cell further includes one or more intra-cell operation units (e.g., arithmetic or logic devices such as a multiplier) that receive an input from the corresponding coefficient storage unit in the same cell. The intra-cell operation unit(s) also receive an input from the corresponding pixel storage unit directly (here the center column, Col. C) or from the output of the multiplexer unit (as in non-center-columns). Results of the intra-cell operations may be further processed with inter-cell operation units 504 (details not shown) to generate a processed output such as an output pixel value.

The input data interface 502 of the 2-D image processing engine 500 couples the array with one or more storage devices (not shown), such as an input buffer and/or an input first-in-first-out (IFIFO) device, that provide fresh pixel values for the three rows of pixel processing cells. More specifically, the fresh pixel values are inputted to the pixel storage units in the edge column on the input side (here Col. E) via input lines 521, 522, and 523 before being propagated to the rest of the columns. Two multiplexers, MUX1 and MUX 3, are provided to allow the center row (here Row 2) pixel values to be duplicated to the non-center-rows, for example, when processing a top or bottom line of an image. Typically, the input image pixel data are all temporarily stored in an input buffer, and therefore all three input lines 521, 522, and 523 are coupled to the input buffer. According to one embodiment of the present invention, one of the input lines (e.g., line 523 which feeds the bottom row input) may be coupled directly to an IFIFO receiving a live feed of one row of the pixel values, therefore saving one third of the buffer space and memory bandwidth that would otherwise be required.

The timing control module 506 coordinates a pipelined process of computing successive pixel blocks of an image against the kernel whose coefficient values are stored in the coefficient storage units. In each clock unit, the timing control module 506 causes one column of fresh pixel values to be fetched into pixel storage units D_(E1), D_(E2), and D_(E3) (here in Col. E) via the data input interface 502. After pixel values of an edge column of the image on a current line are fetched into the edge column pixel storage units (here Col. E), in the next clock unit (T+1), the timing control module 506 may cause a first column on a next line of the image (or a new line of a next frame) to be pre-fetched into an edge column (here Col. E) via the data input interface 502. The pixel values of this edge column are now duplicated to the pixel storage units in the left adjacent column (here Col. D). Then, in the next clock unit (T+1), such pixel values of the edge column can be selected by the multiplexer units in the edge column (here Col. E) for intra-cell operations. During clock unit (T+1), the timing control module 506 may cause a second column on the next line of the image to be pre-fetched into the edge column (here Col. E) via the data input interface 502 while pushing pixel values of the first column on the next line into the left adjacent column (here Col. D) and pushing the pixel values of the edge column on the current line into the next left adjacent column (here Col. C). In the next clock unit (T+2), the pixel values of the edge column can again be selected by the multiplexer units in Col. D and Col. E for intra-cell operations. During clock unit (T+2), the timing control module 506 may cause a third column on the next line of the image to be pre-fetched into the edge column (here Col. E) while pushing pixel values of the first and second columns on the next line into the two left adjacent columns (here Col. C and Col. D respectively). The next clock unit (T+3) will see the 2-D image processing engine 500 ready to proceed with computation on the first pixel on the next line of the image.

The architecture of the 2-D image processing engine 500 shown in FIG. 5 is scalable in both dimensions to accommodate arbitrary kernel sizes. FIG. 6 shows an exemplary 2-D convolution engine 600 with a 5×5 array of pixel processing cells for image processing in accordance with an embodiment of the present invention. For 2-D convolution operations, the intra-cell operation unit in each pixel processing cell is a multiplier, and the inter-cell operation units include adders cascaded to sum up the output products of all the multipliers to finally generate a processed output. With more rows than the 2-D image processing engine 500, the 2-D convolution engine 600 includes additional multiplexers in its input data interface 602 to route center-row pixel values to the non-center rows. A timing control module 606 coordinates the operations of the various elements in a pipelined process wherein the input pixel rate and output pixel rate maintain a one-to-one relationship in accordance with the above-described memory fetch and data routing techniques.

From the examples illustrated in FIGS. 3-6, it can be appreciated that embodiments of the present invention can be implemented in 2-D image processing operations applying any n×m kernel matrix to successive pixel blocks where n and m are typically both odd integers. According to some embodiments, the methods and apparatus disclosed herein may be adapted to accommodate a n×m kernel matrix where n and/or m are even integers. In addition, such 2-D image processing is not limited to convolution operations and can be applied to 2-D correlation or other operations.

While the foregoing description includes many details and specificities, it is to be understood that these have been included for purposes of explanation only, and are not to be interpreted as limitations of the present invention. It will be apparent to those skilled in the art that other modifications to the embodiments described above can be made without departing from the spirit and scope of the invention. Accordingly, such modifications are considered within the scope of the invention as intended to be encompassed by the following claims and their legal equivalents. 

1. A method for processing one or more images having a plurality of pixels, the method comprising: processing successive pixel blocks in raster mode between a first edge and a second edge of an image; during each single clock unit when a next pixel block to be processed does not extend beyond said second edge, fetching, from a storage device, one new vector of the next pixel block; and during each single clock unit when said next pixel block to be processed extends beyond said second edge, filling a new vector in said next pixel block that is located beyond said second edge with predetermined pixel values, and fetching, from said storage device, one new vector of a first pixel block on a next line or frame of pixels; and outputting, in said each single clock unit, one output pixel value, thereby maintaining a constant rate of memory fetches and pixel outputs.
 2. The method according to claim 1, wherein said processing of successive pixel blocks comprises applying an n×m kernel matrix to said successive pixel blocks, n and m being odd integers.
 3. The method according to claim 1, wherein said processing of successive pixel blocks comprises two-dimensional convolution operations.
 4. The method according to claim 1, wherein said processing of successive pixel blocks comprises two-dimensional correlation operations.
 5. The method according to claim 1, wherein said predetermined pixel values are zeros.
 6. The method according to claim 1, wherein said predetermined pixel values are pixel values of a corresponding portion of said second edge.
 7. An apparatus for processing one or more images having a plurality of pixels, the apparatus comprising: means for processing successive pixel blocks in raster mode between a first edge and a second edge of an image; means for, during each single clock unit when a next pixel block to be processed does not extend beyond said second edge, fetching, from a storage device, one new vector of the next pixel block; and means for, during each single clock unit when said next pixel block to be processed extends beyond said second edge, filling a new vector in said next pixel block that is located beyond said second edge with predetermined pixel values, and fetching, from said storage device, one new vector of a first pixel block on a next line or frame of pixels; and means for outputting, in said each single clock unit, one output pixel value, thereby maintaining a constant rate of memory fetches and pixel outputs.
 8. The apparatus according to claim 7, wherein said means for processing successive pixel blocks further comprises means for applying an n×m kernel matrix to said successive pixel blocks, n and m being odd integers.
 9. The apparatus according to claim 7, wherein said means for processing successive pixel blocks further comprises means for two-dimensional convolution operations.
 10. The apparatus according to claim 7, wherein said means for processing successive pixel blocks further comprises means for two-dimensional correlation operations.
 11. The apparatus according to claim 7, wherein said predetermined pixel values are zeros.
 12. The apparatus according to claim 7, wherein said predetermined pixel values are pixel values of a corresponding portion of said second edge.
 13. An apparatus for processing successive pixel blocks in raster mode between a first edge and a second edge of an image, the apparatus comprising: an input data interface coupled with one or more storage devices to receive at least one input stream of pixel values of said image; an array of pixel processing cells, each cell including: a coefficient storage unit that stores a coefficient value of a kernel to be applied to said image during a two-dimensional image processing, a pixel storage unit that stores a pixel value of said image, said pixel storage unit being coupled either to another pixel storage unit of an adjacent cell or to said input data interface, thereby allowing said pixel value to be initially received via said input data interface and subsequently propagated from one vector to an adjacent vector across said array, a multiplexer unit, if said each cell is not in a center vector of said array, having inputs coupled to said pixel storage unit, a center-vector pixel storage unit on the same line of said array, and any pixel storage unit located between said center vector and said each cell, and one or more intra-cell operation units; inter-cell operation units that process outputs from said array of pixel processing cells to generate an output pixel value; and a timing control module that coordinates operations of said input data interface, said array of pixel processing cells, and said inter-cell operation units, wherein during each single clock unit when a next pixel block to be processed does not extend beyond said second edge, said timing control module causes one new vector of said next pixel block to be fetched from said one or more storage devices, and during each single clock unit when said next pixel block to be processed extends beyond said second edge, said timing control module causes a new vector in said next pixel block that is located beyond said second edge to be filled with predetermined pixel values while causing one new vector of a first pixel block on a next line or frame of pixels to be fetched from said one or more storage devices, thereby maintaining a constant rate of memory fetches and pixel outputs. 